package cn.learn.activiti.util;

import lombok.Getter;

/**
 * 简单数学符号
 *
 * @author huangyezhan
 * @version 1.0
 * @date 2021年03月13日18:16
 */
@Getter
public enum SymbolEnum {
    /**
     * 符号、加特殊的名称
     */
    eq("=="," ;_eq "),
    ne("!="," ;_ne "),
    gt(">"," ;_gt "),
    ge(">="," ;_ge "),
    lt("<"," ;_lt "),
    le("<="," ;_le ");

    private final String sym;
    private final String name;

    SymbolEnum(String sym, String name) {
        this.sym = sym;
        this.name = name;
    }

    public static String getNameBySym(String sym){
        SymbolEnum[] values = SymbolEnum.values();
        for (SymbolEnum value : values) {
            if (value.getSym().equalsIgnoreCase(sym)){
                return value.getName();
            }
        }
        return null;
    }

    public static String getSymByName(String name){
        SymbolEnum[] values = SymbolEnum.values();
        for (SymbolEnum value : values) {
            if (value.getName().equalsIgnoreCase(name)){
                return value.getSym();
            }
        }
        return null;
    }


}
